package com.xxx.yuedong.mall.quartz;

import cn.hutool.core.map.MapUtil;
import com.xxx.yuedong.mall.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @author hc
 * @date 2023/09/03 20:20
 **/

public class CancelOrderJob extends QuartzJobBean {

    @Autowired
    private OrderService orderService;

    @Override
    protected void executeInternal(JobExecutionContext ctx) throws JobExecutionException {
        Map map = ctx.getJobDetail().getJobDataMap();
        String orderNo = MapUtil.getStr(map, "orderNo");
        System.out.println("11111111111111111------------------------------------------------------------" + orderNo);
        orderService.cancel(orderNo);
    }
}
